package com.lyf.boot.modules.index.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.lyf.boot.base.user.dao.BaseUserDao;
import com.lyf.boot.base.user.entity.User;
import com.lyf.boot.modules.index.entity.vo.ProfileVo;
import com.lyf.boot.modules.index.service.IProfileService;
import com.lyf.boot.utils.AuthUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 个人中心
 * @author Luyufan
 * @date 2023/12/28 17:44
 **/
@Service
@RequiredArgsConstructor
public class ProfileServiceImpl implements IProfileService {

    private final BaseUserDao baseUserDao;
    @Override
    public ProfileVo getProfile() {
        Long userId = AuthUtil.getUserId();
        User user = baseUserDao.selectById(userId);
        return BeanUtil.copyProperties(user, ProfileVo.class);
    }
}
